//
//  RootTabBarController.m
//  UI09_UITabBarController
//
//  Created by wyx on 16/3/23.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "RootTabBarController.h"
#import "ViewController.h"
#import "SecondViewController.h"
#import "NaviOfFirstViewController.h"
#import "NaviOfSecondViewController.h"

@interface RootTabBarController ()

@end

@implementation RootTabBarController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
        
        // 设置root的viewControllers属性.
        self.viewControllers = [self createRootOfVCs];
        
    }
    
    return self;
}
- (NSArray<UIViewController *> *)createRootOfVCs {
    NSMutableArray *arrOfVCs = [NSMutableArray array];
    //第一个 tabBarItem
    ViewController *vc1 = [[ViewController alloc] init];
    
    NaviOfFirstViewController *item1 = [[NaviOfFirstViewController alloc] initWithRootViewController:vc1];
    
    [arrOfVCs addObject:item1];
    [vc1 release];
    [item1 release];
    item1.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"联系人" image:[UIImage imageNamed:@"iconfont-crmtubiao32"] tag:100];
    
    //第二个 tabBarItem
    SecondViewController *vc2 = [[SecondViewController alloc] init];
    
    NaviOfSecondViewController *item2 = [[NaviOfSecondViewController alloc] initWithRootViewController:vc2];
    
    [arrOfVCs addObject:item2];
    [vc2 release];
    [item2 release];
    item2.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"新闻" image:[UIImage imageNamed:@"iconfont-xinwen"] tag:200];
    return arrOfVCs;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
